package com.yyhh.helpcall.utils;

import android.media.MediaPlayer;

import java.io.IOException;

public class MediaPlayerUtils {

    private MediaPlayer mediaPlayer = new MediaPlayer();

    private MediaPlayerUtils(){

    }

    private static MediaPlayerUtils instance;

    public static MediaPlayerUtils getInstance(){
        if(instance == null){
            instance = new MediaPlayerUtils();
        }
        return instance;
    }

    public void play(String path){
        try {
            mediaPlayer.setDataSource(path);
            mediaPlayer.prepare();
            mediaPlayer.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
